#include<stdio.h>
#include<string.h>
int judge(char* p1, char* p2, int a ) {
	int len = strlen(p1);
	char arr3[len + 1];
	arr3[len] = '\0';
	int n = a % len;
	for (int i = 0; i < len; i++) {
		if (i >= n) {
			arr3[i - n] = * (p1 + i);
		} else {
			arr3[len - 1 - n + i] = * (p1 + i);
		}
	}
	int count = 1;
	for (int i = 0; i < len; i++) {
		if (arr3[i] != * (p2 + i)) {
			count--;
		}
	}
	return count;
}
int main() {
	char arr1[1000] = {0};
	char arr2[1000] = {0};
	scanf("%s", arr1);
	scanf("%s", arr2);
	printf("请输入想对arr1字符串进行左旋的字符数：\n");
	int a = 0;
	scanf("%d", &a);
	int re = judge(arr1, arr2, a);
	printf("%d", re);
	return 0;
}
